using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

using SharpCore.Data;

namespace TF.Access {
	public partial class TF_EventHotel {
		#region Fields
		private int iD;
		private int eventId;
		private int hotelId;
		private int cityID;
		private decimal hotelPrice;
		private string startDate;
		private string startTime;
		private string endDate;
		private string endTime;
		private string remark;
		private int eventLineId;
		private int lanuageId;
		private int scheduleStatus;
		private int stepDay;
		private int startHour;
		private int startMin;
		private int duration;
		private int timeStatus;
		private string locCode;
		#endregion
		
		#region Constructors
		/// <summary>
		/// Initializes a new instance of the TF_EventHotel class.
		/// </summary>
		public TF_EventHotel() {
		}
		
		/// <summary>
		/// Initializes a new instance of the TF_EventHotel class.
		/// </summary>
		public TF_EventHotel(int eventId, int hotelId, int cityID, decimal hotelPrice, string startDate, string startTime, string endDate, string endTime, string remark, int eventLineId, int lanuageId, int scheduleStatus, int stepDay, int startHour, int startMin, int duration, int timeStatus, string locCode) {
			this.eventId = eventId;
			this.hotelId = hotelId;
			this.cityID = cityID;
			this.hotelPrice = hotelPrice;
			this.startDate = startDate;
			this.startTime = startTime;
			this.endDate = endDate;
			this.endTime = endTime;
			this.remark = remark;
			this.eventLineId = eventLineId;
			this.lanuageId = lanuageId;
			this.scheduleStatus = scheduleStatus;
			this.stepDay = stepDay;
			this.startHour = startHour;
			this.startMin = startMin;
			this.duration = duration;
			this.timeStatus = timeStatus;
			this.locCode = locCode;
		}
		
		/// <summary>
		/// Initializes a new instance of the TF_EventHotel class.
		/// </summary>
		public TF_EventHotel(int iD, int eventId, int hotelId, int cityID, decimal hotelPrice, string startDate, string startTime, string endDate, string endTime, string remark, int eventLineId, int lanuageId, int scheduleStatus, int stepDay, int startHour, int startMin, int duration, int timeStatus, string locCode) {
			this.iD = iD;
			this.eventId = eventId;
			this.hotelId = hotelId;
			this.cityID = cityID;
			this.hotelPrice = hotelPrice;
			this.startDate = startDate;
			this.startTime = startTime;
			this.endDate = endDate;
			this.endTime = endTime;
			this.remark = remark;
			this.eventLineId = eventLineId;
			this.lanuageId = lanuageId;
			this.scheduleStatus = scheduleStatus;
			this.stepDay = stepDay;
			this.startHour = startHour;
			this.startMin = startMin;
			this.duration = duration;
			this.timeStatus = timeStatus;
			this.locCode = locCode;
		}
		#endregion
		
		#region Properties
		/// <summary>
		/// Gets or sets the ID value.
		/// </summary>
		public int ID {
			get { return iD; }
			set { iD = value; }
		}
		
		/// <summary>
		/// Gets or sets the EventId value.
		/// </summary>
		public int EventId {
			get { return eventId; }
			set { eventId = value; }
		}
		
		/// <summary>
		/// Gets or sets the HotelId value.
		/// </summary>
		public int HotelId {
			get { return hotelId; }
			set { hotelId = value; }
		}
		
		/// <summary>
		/// Gets or sets the CityID value.
		/// </summary>
		public int CityID {
			get { return cityID; }
			set { cityID = value; }
		}
		
		/// <summary>
		/// Gets or sets the HotelPrice value.
		/// </summary>
		public decimal HotelPrice {
			get { return hotelPrice; }
			set { hotelPrice = value; }
		}
		
		/// <summary>
		/// Gets or sets the StartDate value.
		/// </summary>
		public string StartDate {
			get { return startDate; }
			set { startDate = value; }
		}
		
		/// <summary>
		/// Gets or sets the StartTime value.
		/// </summary>
		public string StartTime {
			get { return startTime; }
			set { startTime = value; }
		}
		
		/// <summary>
		/// Gets or sets the EndDate value.
		/// </summary>
		public string EndDate {
			get { return endDate; }
			set { endDate = value; }
		}
		
		/// <summary>
		/// Gets or sets the EndTime value.
		/// </summary>
		public string EndTime {
			get { return endTime; }
			set { endTime = value; }
		}
		
		/// <summary>
		/// Gets or sets the Remark value.
		/// </summary>
		public string Remark {
			get { return remark; }
			set { remark = value; }
		}
		
		/// <summary>
		/// Gets or sets the EventLineId value.
		/// </summary>
		public int EventLineId {
			get { return eventLineId; }
			set { eventLineId = value; }
		}
		
		/// <summary>
		/// Gets or sets the LanuageId value.
		/// </summary>
		public int LanuageId {
			get { return lanuageId; }
			set { lanuageId = value; }
		}
		
		/// <summary>
		/// Gets or sets the ScheduleStatus value.
		/// </summary>
		public int ScheduleStatus {
			get { return scheduleStatus; }
			set { scheduleStatus = value; }
		}
		
		/// <summary>
		/// Gets or sets the StepDay value.
		/// </summary>
		public int StepDay {
			get { return stepDay; }
			set { stepDay = value; }
		}
		
		/// <summary>
		/// Gets or sets the StartHour value.
		/// </summary>
		public int StartHour {
			get { return startHour; }
			set { startHour = value; }
		}
		
		/// <summary>
		/// Gets or sets the StartMin value.
		/// </summary>
		public int StartMin {
			get { return startMin; }
			set { startMin = value; }
		}
		
		/// <summary>
		/// Gets or sets the Duration value.
		/// </summary>
		public int Duration {
			get { return duration; }
			set { duration = value; }
		}
		
		/// <summary>
		/// Gets or sets the TimeStatus value.
		/// </summary>
		public int TimeStatus {
			get { return timeStatus; }
			set { timeStatus = value; }
		}
		
		/// <summary>
		/// Gets or sets the LocCode value.
		/// </summary>
		public string LocCode {
			get { return locCode; }
			set { locCode = value; }
		}
		#endregion
		
		#region Methods
		/// <summary>
		/// Saves a record to the TF_EventHotel table.
		/// </summary>
		public void Insert() {
			iD = Convert.ToInt32(SqlClientUtility.ExecuteScalar("TF_EventHotelInsert", eventId, hotelId, cityID, hotelPrice, startDate, startTime, endDate, endTime, remark, eventLineId, lanuageId, scheduleStatus, stepDay, startHour, startMin, duration, timeStatus, locCode));
		}
		
		/// <summary>
		/// Updates a record in the TF_EventHotel table.
		/// </summary>
		public void Update() {
			SqlClientUtility.ExecuteNonQuery("TF_EventHotelUpdate", iD, eventId, hotelId, cityID, hotelPrice, startDate, startTime, endDate, endTime, remark, eventLineId, lanuageId, scheduleStatus, stepDay, startHour, startMin, duration, timeStatus, locCode);
		}
		
		/// <summary>
		/// Deletes a record from the TF_EventHotel table by its primary key.
		/// </summary>
		public void Delete() {
			SqlClientUtility.ExecuteNonQuery("TF_EventHotelDelete", iD);
		}
		
		/// <summary>
		/// Selects a single record from the TF_EventHotel table.
		/// </summary>
		public static TF_EventHotel Select(int iD) {
			using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_EventHotelSelect", iD)) {
				if (dataReader.Read()) {
					return MakeTF_EventHotel(dataReader);
				} else {
					return null;
				}
			}
		}
		
		/// <summary>
		/// Selects all records from the TF_EventHotel table.
		/// </summary>
		public static List<TF_EventHotel> SelectAll() {
			using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_EventHotelSelectAll")) {
				List<TF_EventHotel> tF_EventHotelList = new List<TF_EventHotel>();
				while (dataReader.Read()) {
					TF_EventHotel tF_EventHotel = MakeTF_EventHotel(dataReader);
					tF_EventHotelList.Add(tF_EventHotel);
				}
				return tF_EventHotelList;
			}
		}
		
		/// <summary>
		/// Creates a new instance of the TF_EventHotel class and populates it with data from the specified SqlDataReader.
		/// </summary>
		private static TF_EventHotel MakeTF_EventHotel(SqlDataReader dataReader) {
			TF_EventHotel tF_EventHotel = new TF_EventHotel();
			
			if (dataReader.IsDBNull(0) == false) {
				tF_EventHotel.ID = dataReader.GetInt32(0);
			}
			if (dataReader.IsDBNull(1) == false) {
				tF_EventHotel.EventId = dataReader.GetInt32(1);
			}
			if (dataReader.IsDBNull(2) == false) {
				tF_EventHotel.HotelId = dataReader.GetInt32(2);
			}
			if (dataReader.IsDBNull(3) == false) {
				tF_EventHotel.CityID = dataReader.GetInt32(3);
			}
			if (dataReader.IsDBNull(4) == false) {
				tF_EventHotel.HotelPrice = dataReader.GetDecimal(4);
			}
			if (dataReader.IsDBNull(5) == false) {
				tF_EventHotel.StartDate = dataReader.GetString(5);
			}
			if (dataReader.IsDBNull(6) == false) {
				tF_EventHotel.StartTime = dataReader.GetString(6);
			}
			if (dataReader.IsDBNull(7) == false) {
				tF_EventHotel.EndDate = dataReader.GetString(7);
			}
			if (dataReader.IsDBNull(8) == false) {
				tF_EventHotel.EndTime = dataReader.GetString(8);
			}
			if (dataReader.IsDBNull(9) == false) {
				tF_EventHotel.Remark = dataReader.GetString(9);
			}
			if (dataReader.IsDBNull(10) == false) {
				tF_EventHotel.EventLineId = dataReader.GetInt32(10);
			}
			if (dataReader.IsDBNull(11) == false) {
				tF_EventHotel.LanuageId = dataReader.GetInt32(11);
			}
			if (dataReader.IsDBNull(12) == false) {
				tF_EventHotel.ScheduleStatus = dataReader.GetInt32(12);
			}
			if (dataReader.IsDBNull(13) == false) {
				tF_EventHotel.StepDay = dataReader.GetInt32(13);
			}
			if (dataReader.IsDBNull(14) == false) {
				tF_EventHotel.StartHour = dataReader.GetInt32(14);
			}
			if (dataReader.IsDBNull(15) == false) {
				tF_EventHotel.StartMin = dataReader.GetInt32(15);
			}
			if (dataReader.IsDBNull(16) == false) {
				tF_EventHotel.Duration = dataReader.GetInt32(16);
			}
			if (dataReader.IsDBNull(17) == false) {
				tF_EventHotel.TimeStatus = dataReader.GetInt32(17);
			}
			if (dataReader.IsDBNull(18) == false) {
				tF_EventHotel.LocCode = dataReader.GetString(18);
			}

			return tF_EventHotel;
		}
		#endregion
	}
}
